<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>02_新增的音频标签</title>
  <style>
    /*控制audio的宽度和高度*/
    audio {
      width: 600px;
    }
    .container {
      position: fixed;
      left: 0;
      right: 0;
      top: 0;
      bottom: 0;
      background-color: rgba(0, 0, 0, 0.7);
    }
    .content {
      position: absolute;
      width: 400px;
      height: 400px;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
      text-align: center;
      line-height: 400px;
      background-color: pink;
      cursor: pointer;
    }
  </style>
</head>
<body>
<!--必须加上controls 才会出现交互框  不能做到自动播放 loop循环播放 preload预加载-->
  <audio id="music" src="小曲.mp3" controls loop preload="none"></audio>
  <div class="container">
    <div class="content">
      <span>点我登录</span>
      <span onclick="go()">随便听听</span>
    </div>
  </div>
  <script>
    var container = document.querySelector('.container');
    function go() {
      music.play();
      container.style.display = 'none';
    }
  </script>
</body>
</html>